var t = getApp();

Page({
    data: {
        pwd: "",
        rePwd: "",
        pwdBol: !0,
        rePwdBol: !0,
        popupSpecs: !1,
        popupSpecs2: !1
    },
    onLoad: function(t) {
        this._initVerify();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    pwdinp: function(t) {
        this.setData({
            popupSpecs: !0
        });
    },
    popupSpecsClose: function(t) {
        this.setData({
            popupSpecs: !1
        });
    },
    popupSpecsClose2: function(t) {
        this.setData({
            popupSpecs2: !1
        });
    },
    onPassword: function(t) {
        this.setData({
            pwd: t.detail
        });
    },
    onPassword2: function(t) {
        this.setData({
            rePwd: t.detail
        });
    },
    rePwdinp: function(t) {
        this.setData({
            popupSpecs2: !0
        });
    },
    _initVerify: function() {
        var e = t.getNetAddresss("member.balance-password.is-has-password");
        e += "&password=" + this.data.pwd, t._getNetWork({
            url: e,
            success: function(e) {
                var o = e.data;
                1 == o.result ? t._isTextEmpty(o.data.mobile) && wx.showModal({
                    title: "提示",
                    content: "设置密码必须先绑定手机号",
                    success: function(t) {
                        t.confirm ? wx.navigateTo({
                            url: "../../member/editmobile/editmobile"
                        }) : t.cancel && wx.navigateBack({
                            delta: 1
                        });
                    }
                }) : wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    pwdshow: function() {
        this.data.pwdBol ? this.setData({
            pwdBol: !1
        }) : this.setData({
            pwdBol: !0
        });
    },
    rePwdshow: function() {
        this.data.rePwdBol ? this.setData({
            rePwdBol: !1
        }) : this.setData({
            rePwdBol: !0
        });
    },
    setPwd: function() {
        if (t._isTextEmpty(this.data.pwd)) wx.showToast({
            icon: "none",
            title: "支付密码不能为空",
            duration: 1500
        }); else if (t._isTextEmpty(this.data.rePwd)) wx.showToast({
            icon: "none",
            title: "确认密码不能为空",
            duration: 1500
        }); else if (this.data.pwd == this.data.rePwd) {
            var e = t.getNetAddresss("member.balance-password.set-password");
            e += "&password=" + this.data.pwd, e += "&confirmed=" + this.data.rePwd, t._getNetWork({
                url: e,
                success: function(t) {
                    var e = t.data;
                    if (1 == e.result) switch (e.data.code) {
                      case 1:
                        wx.showToast({
                            title: e.msg,
                            icon: "none",
                            duration: 1500,
                            success: function() {
                                setTimeout(function() {
                                    wx.navigateBack({
                                        delta: 1
                                    });
                                }, 1500);
                            }
                        });
                        break;

                      case 2:
                        wx.showToast({
                            icon: "none",
                            title: e.msg,
                            duration: 1500
                        });
                        break;

                      case 3:
                        wx.showModal({
                            title: "提示",
                            content: e.msg,
                            success: function(t) {
                                t.confirm ? wx.navigateTo({
                                    url: "../../member/editmobile/editmobile"
                                }) : t.cancel && wx.navigateBack({
                                    delta: 1
                                });
                            }
                        });
                    } else wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        } else wx.showToast({
            icon: "none",
            title: "支付密码和确认密码必须相同",
            duration: 1500
        });
    }
});